template(name="listBody")
  unless collapsed
    .list-body(class="{{#unless isVerticalScrollbars}}no-scrollbars{{/unless}}")
      .minicards.clearfix.js-minicards(class="{{#if reachedWipLimit}}js-list-full{{/if}}")
        if cards.length
          +inlinedForm(autoclose=false position="top")
            +addCardForm(listId=_id position="top")
        ul.sidebar-list
          each customFieldsSum
            li
              +viewer
                = name
              if $eq customFieldsSum.type "number"
                +viewer
                  = value
              if $eq customFieldsSum.type "currency"
                +viewer
                  = formattedCurrencyCustomFieldValue(value)
        each (cardsWithLimit (idOrNull ../../_id))
          a.minicard-wrapper.js-minicard(href=originRelativeUrl
            class="{{#if cardIsSelected}}is-selected{{/if}}"
            class="{{#if MultiSelection.isSelected _id}}is-checked{{/if}}")
            if MultiSelection.isActive
              .materialCheckBox.multi-selection-checkbox.js-toggle-multi-selection(
                class="{{#if MultiSelection.isSelected _id}}is-checked{{/if}}")
            +minicard(this)
        if (showSpinner (idOrNull ../../_id))
          +spinnerList

        if canSeeAddCard
          +inlinedForm(autoclose=false position="bottom")
            +addCardForm(listId=_id position="bottom")
          else
            a.open-minicard-composer.js-card-composer.js-open-inlined-form(title="{{_ 'add-card-to-bottom-of-list'}}")
              | ➕

template(name="spinnerList")
  .sk-spinner.sk-spinner-list(
    class="{{currentBoard.colorClass}} {{getSkSpinnerName}}"
    id="showMoreResults")
    +spinnerRaw

template(name="addCardForm")
  .minicard.minicard-composer.js-composer
    if getLabels
      .minicard-labels
        each getLabels
          .minicard-label(class="card-label-{{color}}" title="{{name}}")
    textarea.minicard-composer-textarea.js-card-title(autofocus dir="auto")
    if members.get
      .minicard-members.js-minicard-composer-members
        each members.get
          +userAvatar(userId=this)

  .add-controls.clearfix
    button.primary.confirm(type="submit") {{_ 'add'}}
    a.js-close-inlined-form | ❌
  .add-controls.clearfix
    unless currentBoard.isTemplatesBoard
      unless currentBoard.isTemplateBoard
        span.quiet
          | {{_ 'or'}}
          a.js-link {{_ 'link'}}
        span.quiet
          | &nbsp;
          | /
          a.js-search {{_ 'search'}}
        span.quiet
          | &nbsp;
          | /
          a.js-card-template {{_ 'template'}}

template(name="autocompleteLabelLine")
  .minicard-label(class="card-label-{{colorName}}" title=labelName)
  span(class="{{#if hasNoName}}quiet{{/if}}")= labelName

template(name="linkCardPopup")
  label {{_ 'boards'}}:
  .link-board-wrapper
    select.js-select-boards
      option(value="")
      each boards
        option(value="{{_id}}") {{isTitleDefault title}}
    input.primary.confirm.js-link-board(type="button" value="{{_ 'link'}}")

  label {{_ 'swimlanes'}}:
  select.js-select-swimlanes
    each swimlanes
      option(value="{{_id}}") {{isTitleDefault title}}

  label {{_ 'lists'}}:
  select.js-select-lists
    each lists
      option(value="{{_id}}") {{isTitleDefault title}}

  label {{_ 'cards'}}:
  select.js-select-cards
    each cards
      option(value="{{getRealId}}") {{getTitle}}

  .edit-controls.clearfix
    input.primary.confirm.js-done(type="button" value="{{_ 'link'}}")

template(name="searchElementPopup")
  form
    label
      | {{_ 'title'}}
      input.js-element-title(type="text" placeholder="{{_ 'title'}}" autofocus required dir="auto")
  unless isTemplateSearch
    label {{_ 'boards'}}:
    .link-board-wrapper
      select.js-select-boards
        option(value="")
        each boards
          option(value="{{_id}}") {{title}}
  form.js-search-term-form
    label
      | {{_ 'template'}}
    input(type="text" name="searchTerm" placeholder="{{_ 'search-example'}}" autofocus dir="auto")
  .list-body.search-card-results
    .minicards.clearfix.js-minicards
      if isBoardTemplateSearch
        each results
          a.minicard-wrapper.js-minicard
            +miniboard(this)
      if isListTemplateSearch
        each results
          a.minicard-wrapper.js-minicard
            +minilist(this)
      if isSwimlaneTemplateSearch
        each results
          a.minicard-wrapper.js-minicard
            +miniswimlane(this)
      if isCardTemplateSearch
        each results
          a.minicard-wrapper.js-minicard
            +minicard(this)
      unless isTemplateSearch
        each results
          a.minicard-wrapper.js-minicard
            +minicard(this)
